package com.bw.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bw.bean.CArticle;
import com.bw.bean.CCategory;
import com.bw.bean.CChannel;
import com.bw.dao.ArticleDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
@Transactional
public class ServiceImpl implements ServiceL{
	@Autowired
	private ArticleDao dao;

	@Override
	public PageInfo<CArticle> listArt(int pageNum, int pageSize, String name, String cid) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize);
		List<CArticle> list=dao.listArt(name,cid);
		PageInfo<CArticle> page = new PageInfo<CArticle>(list);
		return page;
	}

	@Override
	public List<CChannel> selectchannel() {
		// TODO Auto-generated method stub
		List<CChannel> list=dao.selectchannel();
		return list;
	}

	@Override
	public boolean addarticle(CArticle art) {
		// TODO Auto-generated method stub
		boolean aa=dao.addarticle(art);
		return aa;
	}

	@Override
	public List<CCategory> selectcategory() {
		// TODO Auto-generated method stub
		List<CCategory> list=dao.selectcategory();
		return list;
	}
}
